<?php
/**
 * 模拟bcs服务
 * @author yaoli<yaoli@pateo.com.cn>
 * @version 1.0  
 */
class bcs extends ActionBase1 {
	
	function init() {
	}
	
	/**
	 * 动作
	 *
	 * @see AActionBase::action()
	 */
	public function action() {
		
	}
	
	
	
/**
 * BCS模拟检验方法
 */
	public function checkLogin(){
		/**
		 * status
		 * 100—ture
		 200---false
		 300 --- success
		 400 --- format error: Id is null
		 500 --- internal error
		
		 */
		
		
		if($this->data['request']['pwd']=='error' || !$this->data['request']['phone']|| !$this->data['request']['pwd']){
			$result['checkVo'] = array('status'=>array("code"=>200,"description"=>false));
		}else{
			$result['checkVo'] = array('status'=>array("code"=>100,"description"=>true),
					"vhlUserVo"=>array("id"=>2,"descript"=>"张三","credentials"=>1,"credentialsNum"=>222222,"sex"=>"1","birthday"=>"1998-06-01","mobilePhone"=>"1301641881",
							"phone"=>"107241880","minMessage"=>"22121","email"=>"1234545@yahoo.cn","advertisement"=>1,"cityId "=>"1","address"=>"湖北省武汉市武昌区珞瑜路1号",
							"zip"=>"439999","hobby"=>"打球","remark"=>"aaaa",	"vhlUserPassWord"=>"123456"
					));
		}
		
		echo json_encode($result);
		
	}
	
	/**
	 * BCS重置密码操作
	 */
	
	public function changePassword(){
		header('content-type:application/json;charset=utf-8');
		if(is_numeric($this->data['request']['phone'])){
			$json =  '{"status": {"code": 100,"description": "ture"}}';
		}else{
			$json =  '{"status": {"code": 200,"description": "false"}}';
		}
		echo $json;
	}
	
	/**
	 * BCS返回用户相关信息接口
	 */
	public function queryCustomer(){
		header('content-type:application/json;charset=utf-8');
		$json = null;
		if(isset($this->data['request']['data'])){
			
			$uid = (json_decode(stripslashes($this->data['request']['data'])));
			
			if($uid->VhlCustomerVo->vhlCustomer->id){
				
			 $json='[{"resultVo":{
			 "customer":{"id":"1",
			 "descript":"张三",
			 "customerType":"1",
			 "credentials":"2223",
			 "credentialsNum":"222222",
			 "sex":"1",
			 "birthday":"1998-06-01 ",
			 "mobilePhone":"1301641881 ",
			 "phone":"86412888",
			 "qq":"107241880",
			 "minMessage":"22121 ",
			 "email":"1234545@yahoo.cn",
			 "advertisement": "1",
			 "cityId ":"1 ",
			 "address":"湖北省武汉市武昌区珞瑜路1号",
			 "zip":"439999",
			 "hobby":"打球",
			 "remark":"aaaa",
			 "vipProperty":"121",
			 "vhllanguagecode":"en",
			 "customergroup":"1",
			 "insuranceid":"12312321",
			 "insurancename":"aaaaa",
			 "vipPreferences":"aaa",
			 "questionOne":"aaa",
			 "answerOne":"bbb",
			 "questionTwo":"aaaaa1",
			 "answerTwo":"bbb1",
			 "contact":"联系人",
			 "contactPhone":"123123",
			 "vhlMobilePhone":"123123"
			 },
			 "vhlList":[{
			 "vin":"1",
			 "customerId":"2211",
			 "color":"红色",
			 "vhlLicence":"11221",
			 "vhlBrandId":"1 ",
			 "vhlSeriesId":"112",
			 "vhlTypeId ":"121",
			 "colorId": "232232",
			 "vhlStatus":"2",
			 "insuranceId":"2",
			 "dealerId":"2",
			 "doptCode":"123",
			 "remark":"asdasd",
			 "vhlUserId":"123123",
			 "istest":"0"
			 },
			 {
			 "vin":"2",
			 "customerId":"2211",
			 "color":"红色",
			 "vhlLicence":"11221",
			 "vhlBrandId":"1 ",
			 "vhlSeriesId":"112",
			 "vhlTypeId ":"121",
			 "colorId": "232232",
			 "vhlStatus":"2",
			 "insuranceId":"2",
			 "dealerId":"2",
			 "doptCode":"123",
			 "remark":"asdasd",
			 "vhlUserId":"123123",
			 "istest":"0"
			 }]
			 }}]';
			 
			 $json1='[{"resultVo":{
			 "customer":{"id":"1",
			 "descript":"张三",
			 "customerType":"1",
			 "credentials":"2223",
			 "credentialsNum":"222222",
			 "sex":"1",
			 "birthday":"1998-06-01 ",
			 "mobilePhone":"1301641881 ",
			 "phone":"86412888",
			 "qq":"107241880",
			 "minMessage":"22121 ",
			 "email":"1234545@yahoo.cn",
			 "advertisement": "1",
			 "cityId ":"1 ",
			 "address":"湖北省武汉市武昌区珞瑜路1号",
			 "zip":"439999",
			 "hobby":"打球",
			 "remark":"aaaa",
			 "vipProperty":"121",
			 "vhllanguagecode":"en",
			 "customergroup":"1",
			 "insuranceid":"12312321",
			 "insurancename":"aaaaa",
			 "vipPreferences":"aaa",
			 "questionOne":"aaa",
			 "answerOne":"bbb",
			 "questionTwo":"aaaaa1",
			 "answerTwo":"bbb1",
			 "contact":"联系人",
			 "contactPhone":"123123",
			 "vhlMobilePhone":"123123"
			 },
			 "vhlList":[{
			 "vin":"1",
			 "customerId":"2211",
			 "color":"红色",
			 "vhlLicence":"11221",
			 "vhlBrandId":"1 ",
			 "vhlSeriesId":"112",
			 "vhlTypeId ":"121",
			 "colorId": "232232",
			 "vhlStatus":"2",
			 "insuranceId":"2",
			 "dealerId":"2",
			 "doptCode":"123",
			 "remark":"asdasd",
			 "vhlUserId":"123123",
			 "istest":"0"
			 }]
			 }}]';
			}
		}
		
		
		#return $json;
		#$json1 = json_decode($json,true);
		#echo hex(1001);
		#$json1= json_decode($json,true);
		
		echo $json;
	}
	
	public function updateCustomer(){
		header('content-type:application/json;charset=utf-8');
		$json = '{
					"status": {
					            "code": 100,
					            "description": "ture"
					        }
					}';
		
		echo $json;
	}
	
	public function getContractInfo(){
		header('content-type:application/json;charset=utf-8');
		if(isset($this->data['request']['vin'])){
		$json = '{"resultVo":{
		
		"contract":{"id": "1",
        "vin": "232232",
        "contractBeginTime":"2113-10-10",
        "contractEndTime":"2115-10-10",
		"contractMoney ":"500000",
		"payMode":"1 ",
		"payDate":"2113-10-10"
		},
		"servicePkg": {
		"id":"1",
        "name":"232232",
        "descript":"11221",
		"rebate":"50%",
		"packBeginTime":"2013-03-01",
		"packEndTime":"2014-03-01",
		"packFee": "111"
       },
       
       "serviceList":[{
			        "id":"1",
			        "serviceType":"2211",
			        "name":"232232",
			        "descript":"11221",
					"serviceFee":"11221",
					"serviceRebate":"11221",
					"serviceCount":"200"
			 },
			{
			        "id":"2",
			        "serviceType":"2211",
			        "name":"232232",
			        "descript":"11221",
					"serviceFee":"11221",
					"serviceRebate":"11221",
					"serviceCount":"200"
			 }]
	}}';
		
		echo $json;
		}
	}
	
	public function updatePin(){
		header('content-type:application/json;charset=utf-8');
		
		if(isset($this->data['request']['userId']) && isset($this->data['request']['pin'])){
			$json = '{
			"status": {
			            "code": 300,
			            "description": "success"
			        }
			}';
	
			echo $json;
		}
	}
				
	
	

}